//
//  Protocol.swift
//  XBasicKit
//
//  Created by x on 2024/8/30.
//
import Foundation
//import Hero

// MARK: - 路由协议定义

public protocol AppRoute {
    
    var viewController: UIViewController { get }
    var transitionStyle: TransitionStyle { get }
    /// 仅支持@objc ，因为用的kvc,
    /// 可以使用 case alert(title: String, message: String)，在viewController里面进行赋值
    var parameters: [String: Any]? { get }
    
    static func from(url: URLConvertible) -> Self?
}

// MARK: - 跳转方式定义

public enum TransitionStyle {
    case root(in: UIWindow)
    
    case push(from: UIViewController? = nil, animated: Bool = true)
    case present(from: UIViewController?, wrap: UINavigationController.Type? = nil, animated: Bool = true)
    case detail(from: UIViewController?, wrap: UINavigationController.Type? = nil)
    case custom((UINavigationController?, UIViewController?) -> Void) // 支持自定义跳转逻辑
    
//    case navigation(from: UINavigationController? = nil, animated: Bool = true, type: HeroDefaultAnimationType)
//    case customModal(from: UIViewController?,wrap: UINavigationController.Type? = nil, type: HeroDefaultAnimationType)
    case navigation(from: UINavigationController? = nil, animated: Bool = true)
    case customModal(from: UIViewController?,wrap: UINavigationController.Type? = nil)
}
